package com.infodms.dms.actions.claim.oldPart;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;

import com.infodms.dms.actions.claim.application.BalanceStatusRecord;
import com.infodms.dms.bean.AclUserBean;
import com.infodms.dms.bean.ClaimApproveAndStoredReturnInfoBean;
import com.infodms.dms.bean.ClaimOldPartApproveStoreListBean;
import com.infodms.dms.bean.TtAsWrOldPartSignDetailListBean;
import com.infodms.dms.common.Constant;
import com.infodms.dms.common.ErrorCodeConstant;
import com.infodms.dms.common.getCompanyId.GetOemcompanyId;
import com.infodms.dms.dao.claim.oldPart.ClaimApproveOldPartStoredDao;
import com.infodms.dms.dao.claim.oldPart.ClaimBackListDao;
import com.infodms.dms.dao.claim.oldPart.ClaimTools;
import com.infodms.dms.exception.BizException;
import com.infodms.dms.po.TtAsDealerTypePO;
import com.infodms.dms.po.TtAsWrOldReturnedDetailPO;
import com.infodms.dms.po.TtAsWrOldReturnedPO;
import com.infodms.dms.po.TtAsWrReturnedOrderPO;
import com.infodms.dms.util.CommonUtils;
import com.infoservice.mvc.context.ActionContext;
import com.infoservice.mvc.context.RequestWrapper;
import com.infoservice.po3.bean.PageResult;
/**
 * 类说明：索赔旧件管理--审批入库功能
 * 作者：  赵伦达
 */
public class ClaimOldPartApporoveStorageManager {
	public Logger logger = Logger.getLogger(ClaimOldPartApporoveStorageManager.class);
	private ActionContext act = null;
	private AclUserBean logonUserBean = null;
	private RequestWrapper request=null;
	private ClaimApproveOldPartStoredDao dao=null;
	//url导向
	private final String queryApproveListOrdUrl = "/jsp/claim/oldPart/queryApproveStorageList.jsp";
	private final String approveAndStoredPageUrl = "/jsp/claim/oldPart/approveAndStoredReturnList.jsp";
	/** 
	 * modify xzm 20100907 
	 * approveAndStoredPageUrl2 替换原来的 approveAndStoredPageUrl 
	 * 需求人员确定长安 针对一张回运单 只做一次签收动作
	 */
	private final String approveAndStoredPageUrl2 = "/jsp/claim/oldPart/approveAndStoredReturnList2.jsp";
	private final String queryDetailPageUrl = "/jsp/claim/oldPart/queryStoredDetailInfo.jsp";
	
	/**
	 * Function：索赔旧件审批入库--初始化
	 * @param  ：	
	 * @return:		 
	 * @throw：	
	 * LastUpdate：	2010-6-10 赵伦达
	 */
	public void queryListPage(){
		try {
			act=ActionContext.getContext();
			logonUserBean=(AclUserBean) act.getSession().get(Constant.LOGON_USER);
			//取得该用户拥有的产地权限
			String yieldly = CommonUtils.findYieldlyByPoseId(logonUserBean.getPoseId());
			
			act.setOutData("yieldly", yieldly);
			act.setForword(queryApproveListOrdUrl);
		} catch (Exception e) {
			BizException e1 = new BizException(act, e,ErrorCodeConstant.QUERY_FAILURE_CODE, "索赔旧件审批入库--初始化");
			logger.error(logonUserBean, e1);
			act.setException(e1);
		}
	}
	/**
	 * Function：索赔件审批入库--条件查询
	 * @param  ：	
	 * @return:		 
	 * @throw：	
	 * LastUpdate：	2010-6-12 赵伦达
	 */
	public void queryApproveList(){
		act=ActionContext.getContext();
		request = act.getRequest();
		logonUserBean=(AclUserBean) act.getSession().get(Constant.LOGON_USER);
		dao=ClaimApproveOldPartStoredDao.getInstance();
		Map<String,String> params=new HashMap<String, String>();
		Long companyId=GetOemcompanyId.getOemCompanyId(logonUserBean);
		// 处理当前页
		Integer curPage = request.getParamValue("curPage") != null ? Integer
				.parseInt(request.getParamValue("curPage")) : 1;
		try {
			
			String yieldlys = CommonUtils.findYieldlyByPoseId(logonUserBean.getPoseId());//该用户拥有的产地
			String yieldly = request.getParamValue("yieldly");//查询条件=产地
			
			params.put("company_id",String.valueOf(companyId));
			params.put("i_dealer_code",request.getParamValue("dealerCode"));//经销商代码 
			params.put("i_dealer_name",request.getParamValue("dealerName"));//经销商简称
			params.put("i_return_no",request.getParamValue("back_order_no"));//回运清单号
			params.put("i_create_start_date",request.getParamValue("create_start_date"));//建单开始时间 
			params.put("i_create_end_date",request.getParamValue("create_end_date"));//建单结束时间
			params.put("i_submit_start_date",request.getParamValue("report_start_date"));//提报开始时间
			params.put("i_submit_end_date",request.getParamValue("report_end_date"));//提报结束时间
			params.put("i_transport_type",request.getParamValue("freight_type"));//货运方式
			params.put("i_back_type",request.getParamValue("back_type"));//回运单状态
			params.put("i_trans_no",request.getParamValue("trans_no"));//货运单号
			params.put("yieldlys", yieldlys);
			params.put("yieldly", yieldly);
			
			PageResult<ClaimOldPartApproveStoreListBean> ps = dao.queryClaimBackList(params,curPage,
					Constant.PAGE_SIZE);
			act.setOutData("ps", ps);
			act.setForword(queryApproveListOrdUrl);
		} catch (Exception e) {
			BizException e1 = new BizException(act, e,ErrorCodeConstant.QUERY_FAILURE_CODE, "索赔件审批入库--条件查询");
			logger.error(logonUserBean, e1);
			act.setException(e1);
		}
	}
	/**
	 * Function：索赔件审批入库--转到入库页面
	 * @param  ：	
	 * @return:		 
	 * @throw：	
	 * LastUpdate：	2010-6-13
	 */
	public void goApproveAndStoredPage(){
		act=ActionContext.getContext();
		request = act.getRequest();
		logonUserBean=(AclUserBean) act.getSession().get(Constant.LOGON_USER);
		dao=ClaimApproveOldPartStoredDao.getInstance();
		Map<String,String> params=new HashMap<String, String>();
		// 处理当前页
		Integer curPage = request.getParamValue("curPage") != null ? Integer
				.parseInt(request.getParamValue("curPage")) : 1;
		
		//回运要入库的回运清单号
		String claim_id=request.getParamValue("CLAIM_ID");//此处为回运清单中的主键
		params.put("i_claim_id", claim_id);
		try {
			//获取回运清单信息bean
			ClaimApproveAndStoredReturnInfoBean returnListBean=dao.getApproveAndStoredReturnInfo(params);
			request.setAttribute("returnListBean", returnListBean);
			
			//获取回运清单明细信息List
			PageResult<TtAsWrOldPartSignDetailListBean> ps=dao.queryClaimBackDetailList(params,curPage,
					Constant.PAGE_SIZE);
			request.setAttribute("detailList", (List<TtAsWrOldPartSignDetailListBean>)ps.getRecords());
			act.setOutData("ps", ps);
			act.setForword(approveAndStoredPageUrl);
		} catch (Exception e) {
			BizException e1 = new BizException(act, e,ErrorCodeConstant.QUERY_FAILURE_CODE, "索赔件审批入库--转到入库页面");
			logger.error(logonUserBean, e1);
			act.setException(e1);
		}
	}
	
	/**
	 * 索赔件审批入库--转到入库页面
	 * 注：需求人员确定长安 针对一张回运单 只做一次签收动作,页面数据没有分页
	 * 原操作方式：可以多次签收 goApproveAndStoredPage
	 * @param  ：	
	 * @return:		 
	 * @throw：	
	 * LastUpdate：	2010-09-07
	 */
	public void goApproveAndStoredPage2(){
		act=ActionContext.getContext();
		request = act.getRequest();
		logonUserBean=(AclUserBean) act.getSession().get(Constant.LOGON_USER);
		dao=ClaimApproveOldPartStoredDao.getInstance();
		Map<String,String> params=new HashMap<String, String>();
		
		//回运要入库的回运清单号
		String claim_id=request.getParamValue("CLAIM_ID");//此处为回运清单中的主键
		String boxNo=request.getParamValue("boxNo");
		params.put("i_claim_id", claim_id);
		params.put("boxNo", boxNo);
		try {
			//获取回运清单信息bean
			ClaimApproveAndStoredReturnInfoBean returnListBean=dao.getApproveAndStoredReturnInfo(params);
			
			//获取回运清单明细信息List
			List<Map<String,Object>> detailList =dao.queryClaimBackDetailList2(params);
			
			List<Map<String,Object>> detailList1 =dao.queryClaimBackDetailList3(claim_id);
			
			/*********Iverson add By 2010-12-14 查询装箱单号(并去掉空和重复)*********************/
			ClaimBackListDao claimBackDao = ClaimBackListDao.getInstance();
			List<Map<String, Object>> listBoxNo =claimBackDao.getBoxNo(Long.parseLong(claim_id));
			act.setOutData("listBoxNo", listBoxNo);
			act.setOutData("claim_id", claim_id);
			act.setOutData("boxNo", boxNo);
			/*********Iverson add By 2010-12-14 查询装箱单号(并去掉空和重复)*********************/
			
			act.setOutData("returnListBean", returnListBean);
			act.setOutData("detailList", detailList);
			act.setOutData("detailList1", detailList1);
			act.setForword(this.approveAndStoredPageUrl2);
		} catch (Exception e) {
			BizException e1 = new BizException(act, e,ErrorCodeConstant.QUERY_FAILURE_CODE, "索赔件审批入库--转到入库页面");
			logger.error(logonUserBean, e1);
			act.setException(e1);
		}
	}
	
	public void goApproveAndStoredPage22(){
		act=ActionContext.getContext();
		request = act.getRequest();
		logonUserBean=(AclUserBean) act.getSession().get(Constant.LOGON_USER);
		dao=ClaimApproveOldPartStoredDao.getInstance();
		Map<String,String> params=new HashMap<String, String>();
		
		String id=request.getParamValue("id");
		String boxNo=request.getParamValue("boxNo");
		params.put("id", id);
		params.put("boxNo", boxNo);
		try {
			List<Map<String,Object>> detailList =dao.queryClaimBackDetailList22(params);
			act.setOutData("detailList", detailList);
			act.setOutData("ok", "ok");
		} catch (Exception e) {
			BizException e1 = new BizException(act, e,ErrorCodeConstant.QUERY_FAILURE_CODE, "aaaaaaaaaaa");
			logger.error(logonUserBean, e1);
			act.setException(e1);
		}
	}
	
	//判断旧件开始时间不能等于旧件审核日期的话，就不能操作
	public void goApproveAndStoredPage3(){
		act=ActionContext.getContext();
		request = act.getRequest();
		logonUserBean=(AclUserBean) act.getSession().get(Constant.LOGON_USER);
		dao=ClaimApproveOldPartStoredDao.getInstance();
		/*******Iverson add By 根据回运物流单Id更新签收旧件时间********************/
		String id = request.getParamValue("id");
		List list = dao.queryMinDate(id);
		Map map=(Map)list.get(0);
		String oldReviewDate = map.get("WR_START_DATE").toString();//签收时间
		String yieldly = map.get("YIELDLY").toString();//基地
		String dealerId = map.get("DEALER_ID").toString();
		oldReviewDate = oldReviewDate.substring(0,10);
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		TtAsDealerTypePO po = new TtAsDealerTypePO();
		po.setDealerId(Long.parseLong(dealerId));
		po.setYieldly(yieldly);
		TtAsDealerTypePO time = (TtAsDealerTypePO)dao.select(po).get(0);
		Date time1 =time.getOldReviewDate();
		try {
			Calendar calendar = Calendar.getInstance();//公用类，加年月日的
			calendar.setTime(time1);
			calendar.add(Calendar.DAY_OF_MONTH, 1);//当月加一天(如果是本月的最后一天那么结果会是下月的第一天)
			time1 = calendar.getTime();//得到加一天后的值
			if(time1.equals(sdf.parse(oldReviewDate))){
				act.setOutData("ok", "ok");
				act.setOutData("id", id);
			}
		} catch (ParseException e) {
			e.printStackTrace();
		}
		/****************************/
	}
	/**
	 * Function：索赔件审批入库--签收操作
	 * @param  ：	
	 * @return:		 
	 * @throw：	
	 * LastUpdate：	2010-6-13 赵伦达
	 */
	public void approveAndStored(){
		act=ActionContext.getContext();
		request = act.getRequest();
		logonUserBean=(AclUserBean) act.getSession().get(Constant.LOGON_USER);
		dao=ClaimApproveOldPartStoredDao.getInstance();
		Map<String,String> params=new HashMap<String, String>();
		Long companyId=GetOemcompanyId.getOemCompanyId(logonUserBean);
		int updateSuccessNum=0;
		// 处理当前页
		Integer curPage = request.getParamValue("curPage") != null ? Integer
				.parseInt(request.getParamValue("curPage")) : 1;
		
		String idStr=request.getParamValue("idStr");//被签收的id串
		
		try {
			params.put("idStr", idStr);
			params.put("return_ord_id", request.getParamValue("return_ord_id"));
			params.put("logonId",String.valueOf(logonUserBean.getUserId()));
			//取出签收id的参数
			String[] strArr=idStr.split(",");
			for(int count=0;count<strArr.length;count++){
				params.put("signNum"+strArr[count], request.getParamValue("signNum"+strArr[count]));
				params.put("wrHouse"+strArr[count], request.getParamValue("wrHouse"+strArr[count]));
				params.put("deduct"+strArr[count], request.getParamValue("deduct"+strArr[count]));
			}
			params.put("company_id",String.valueOf(companyId));
			updateSuccessNum=dao.SignBackOldPartOper(params);
			if(updateSuccessNum==strArr.length){
				
				//获取回运清单明细信息List
				PageResult<TtAsWrOldPartSignDetailListBean> ps=dao.queryClaimBackDetailList(params,curPage,
						Constant.PAGE_SIZE);
				act.setOutData("ps", ps);
				act.setOutData("updateResult","updateSuccess");
			}else{
				act.setOutData("updateResult","updateFailure");
			}
		} catch (Exception e) {
			BizException e1 = new BizException(act, e,ErrorCodeConstant.QUERY_FAILURE_CODE, "索赔件审批入库--签收操作");
			logger.error(logonUserBean, e1);
			act.setException(e1);
		}
	}
	
	/**
	 * Function：索赔件审批入库--签收操作(批量全部签收)，没有部分签收过程
	 * 原功能连接：approveAndStored
	 * @param  ：	
	 * @return:		 
	 * @throw：	
	 * LastUpdate：	2010-09-07 XZM ADD 
	 * 2010-10-13 修改
	 * 描述： 
	 *     库存表中加入产地记录，配件需要按产地区分开来
	 * 影响：
	 *     ClaimApproveOldPartStoredDao.SignFinishOper();
	 */
	@SuppressWarnings("unchecked")
	public void approveAndStored2(){
		act=ActionContext.getContext();
		request = act.getRequest();
		logonUserBean=(AclUserBean) act.getSession().get(Constant.LOGON_USER);
		dao=ClaimApproveOldPartStoredDao.getInstance();
		Map<String,String> params=new HashMap<String, String>();
		Long companyId=GetOemcompanyId.getOemCompanyId(logonUserBean);
		int updateSuccessNum=0;
		String return_ord_id = request.getParamValue("return_ord_id");
		String boxNo = request.getParamValue("boxNo");
		try {
			params.put("return_ord_id", return_ord_id);
			params.put("logonId",String.valueOf(logonUserBean.getUserId()));
			
			String[] strArr= request.getParamValues("orderIds");
			int updateNum = 0;
			for(int count=0;count<strArr.length;count++){
				String signNum=ClaimTools.dealParamStr(request.getParamValue("signNum"+strArr[count]));//签收数
				String wrHouseNo=ClaimTools.dealParamStr(request.getParamValue("wrHouse"+strArr[count]));//库区
				String deduct=ClaimTools.dealParamStr(request.getParamValue("deduct"+strArr[count]));//抵扣原因
				
				TtAsWrOldReturnedDetailPO idObj=new TtAsWrOldReturnedDetailPO();
				idObj.setId(Long.parseLong(strArr[count]));
				
				TtAsWrOldReturnedDetailPO vo=new TtAsWrOldReturnedDetailPO();
				vo.setSignAmount(Integer.parseInt(signNum));
				vo.setWarehouseRegion(wrHouseNo);
				vo.setIsSign(1L);//是否签收的标志
				if(!"".equals(deduct)){
					vo.setDeductRemark(Integer.parseInt(deduct));
				}else{
					vo.setDeductRemark(0);
				}
				
				updateNum+=dao.update(idObj,vo);
			}
			params.put("company_id",String.valueOf(companyId));
			//签收回运单，修改回运单明细
			updateSuccessNum=updateNum;
			
			if(updateSuccessNum==strArr.length){
				params.put("i_claim_id", return_ord_id);
				//修改回运单状态（删除部分签收过程）
				TtAsWrOldReturnedPO idObj=new TtAsWrOldReturnedPO();
				idObj.setId(Long.parseLong(return_ord_id));
				TtAsWrOldReturnedPO vo=new TtAsWrOldReturnedPO();
				int count = dao.queryIsSign(Long.parseLong(return_ord_id));//判断是否已经签收完了。
				if(count==0){
					vo.setStatus(Constant.BACK_LIST_STATUS_04);//全部签收
					/*******Inerson add By 根据回运物流单Id更新签收旧件时间********************/
					SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
					List list = dao.queryReturnOrder(return_ord_id);
					for(int i=0;i<list.size();i++){
						Map map=(Map)list.get(i);
						TtAsDealerTypePO po = new TtAsDealerTypePO();
						po.setDealerId(((BigDecimal)map.get("DEALER_ID")).longValue());//经销商ID
						po.setYieldly(map.get("YIELDLY").toString());//基地
						TtAsDealerTypePO poValue = new TtAsDealerTypePO();
						String oldReviewDate = map.get("WR_START_DATE").toString();//签收时间
						oldReviewDate = oldReviewDate.substring(11,oldReviewDate.length());
						TtAsDealerTypePO time = (TtAsDealerTypePO)dao.select(po).get(0);
						Date oldReviewTime = time.getOldReviewDate();//查询本来的时间
						if(sdf.parse(oldReviewDate).after(oldReviewTime) || sdf.parse(oldReviewDate).equals(oldReviewTime)){//比较如果页面的时间在本来的时间之前那么就更新
							poValue.setOldReviewDate(sdf.parse(oldReviewDate));//跟新时间
						}else{
							poValue.setOldReviewDate(oldReviewTime);//跟新时间
						}
						dao.update(po, poValue);
						
						//把回运单的状态改为已签收
						TtAsWrReturnedOrderPO poReturn = new TtAsWrReturnedOrderPO();
						poReturn.setId(((BigDecimal)map.get("ID")).longValue());
						TtAsWrReturnedOrderPO poReturnValue = new TtAsWrReturnedOrderPO();
						poReturnValue.setStatus(Constant.RETURNORDER_TYPE_04);
						poReturnValue.setUpdateBy(logonUserBean.getUserId());
						poReturnValue.setUpdateDate(new Date());
						dao.update(poReturn, poReturnValue);
					}
					/*******Inerson add By 根据回运单Id更新签收旧件时间********************/
					
					//记录审核人，审核时间信息 Iverson 2010-01-04
					ReturnStatusRecord.recordStatus(Long.parseLong(return_ord_id), logonUserBean.getUserId(), logonUserBean.getName(),logonUserBean.getOrgId(), Constant.BACK_LIST_STATUS_04,boxNo);
				}else{
					vo.setStatus(Constant.BACK_LIST_STATUS_03);//部分签收
					//把回运单的状态改为已签收
					/*List list = dao.queryReturnOrder(return_ord_id);
					for(int i=0;i<list.size();i++){
						Map map=(Map)list.get(i);
						TtAsWrReturnedOrderPO poReturn = new TtAsWrReturnedOrderPO();
						poReturn.setId(((BigDecimal)map.get("ID")).longValue());
						TtAsWrReturnedOrderPO poReturnValue = new TtAsWrReturnedOrderPO();
						poReturnValue.setStatus(Constant.RETURNORDER_TYPE_04);
						poReturnValue.setUpdateBy(logonUserBean.getUserId());
						poReturnValue.setUpdateDate(new Date());
						dao.update(poReturn, poReturnValue);
					}*/
					
					//记录审核人，审核时间信息 Iverson 2010-01-04
					ReturnStatusRecord.recordStatus(Long.parseLong(return_ord_id), logonUserBean.getUserId(), logonUserBean.getName(),logonUserBean.getOrgId(), Constant.BACK_LIST_STATUS_03,boxNo);
				}
				vo.setUpdateBy(logonUserBean.getUserId());
				vo.setUpdateDate(new Date());
				dao.update(idObj,vo);
				//获取回运清单明细信息List
				//List<Map<String,Object>> detailList =dao.queryClaimBackDetailList2(params);
				//act.setOutData("detailList", detailList);
				//将签收入库的件入库管理（库存）
				Map<String,String> paramsMap=new HashMap<String, String>();
				paramsMap.put("id", return_ord_id);//回运清单ID
				paramsMap.put("logonId", logonUserBean.getUserId().toString());//登陆用户ID
				paramsMap.put("company_id", companyId.toString());//登陆用户所属公司ID
				dao.SignFinishOper(paramsMap);
				act.setOutData("updateResult","updateSuccess");
			}else{
				act.setOutData("updateResult","updateFailure");
			}
		} catch (Exception e) {
			BizException e1 = new BizException(act, e,ErrorCodeConstant.QUERY_FAILURE_CODE, "索赔件审批入库--签收操作");
			logger.error(logonUserBean, e1);
			act.setException(e1);
		}
	}
	
	/**
	 * Function：索赔件审批入库--签收完成
	 * @param  ：	
	 * @return:		 
	 * @throw：	
	 * LastUpdate：	2010-6-17
	 */
	public void approveAndFinish(){
		act=ActionContext.getContext();
		request = act.getRequest();
		logonUserBean=(AclUserBean) act.getSession().get(Constant.LOGON_USER);
		Long companyId=GetOemcompanyId.getOemCompanyId(logonUserBean);
		dao=ClaimApproveOldPartStoredDao.getInstance();
		Map<String,String> params=new HashMap<String, String>();
		String id=request.getParamValue("id");//回运清单主键
		//String transNo=request.getParamValue("transNo");//货运单号
		int updateSuccessNum=0;
		try {
			params.put("company_id",String.valueOf(companyId));
			params.put("id",id);
			//params.put("transNo",transNo);
			params.put("logonId",String.valueOf(logonUserBean.getUserId()));
			updateSuccessNum=dao.SignFinishOper(params);//更改签收完成数据操作
			if(updateSuccessNum==1){
				act.setOutData("finishResult","finishSuccess");
			}else{
				act.setOutData("finishResult","finishFailure");
			}
		} catch (Exception e) {
			BizException e1 = new BizException(act, e,ErrorCodeConstant.QUERY_FAILURE_CODE, "索赔件审批入库--签收完成");
			logger.error(logonUserBean, e1);
			act.setException(e1);
		}
	}
	/**
	 * Function：索赔旧件审批入库--查询明细
	 * @param  ：	
	 * @return:		 
	 * @throw：	
	 * LastUpdate：	2010-7-9
	 */
	public void queryDetail(){
		try {
			act=ActionContext.getContext();
			request = act.getRequest();
			logonUserBean=(AclUserBean) act.getSession().get(Constant.LOGON_USER);
			dao=ClaimApproveOldPartStoredDao.getInstance();
			Map<String,String> params=new HashMap<String, String>();
			// 处理当前页
			@SuppressWarnings("unused")
			Integer curPage = request.getParamValue("curPage") != null ? Integer
					.parseInt(request.getParamValue("curPage")) : 1;
			
			//回运要入库的回运清单号
			String claim_id=request.getParamValue("CLAIM_ID");//此处为回运清单中的主键
			params.put("i_claim_id", claim_id);
			
			//获取回运清单信息bean
			ClaimApproveAndStoredReturnInfoBean returnListBean=dao.getApproveAndStoredReturnInfo(params);
			request.setAttribute("returnListBean", returnListBean);
			
			//获取回运清单明细信息List
			List<TtAsWrOldPartSignDetailListBean> ps=dao.queryClaimBackDetailList3(params);
			request.setAttribute("detailList", ps);
			act.setOutData("ps", ps);
			act.setForword(queryDetailPageUrl);
		} catch (Exception e) {
			BizException e1 = new BizException(act, e,ErrorCodeConstant.QUERY_FAILURE_CODE, "索赔旧件审批入库--查询明细");
			logger.error(logonUserBean, e1);
			act.setException(e1);
		}
	}
	/**
	 * Function：索赔旧件审批入库--在签收完成操作前检查工单是否完成签收操作
	 * @param  ：	
	 * @return:		 
	 * @throw：	
	 * LastUpdate：	2010-7-24 ZLD
	 */
	@SuppressWarnings("unchecked")
	public void validateIsSignOper(){
		try {
			act=ActionContext.getContext();
			request = act.getRequest();
			logonUserBean=(AclUserBean) act.getSession().get(Constant.LOGON_USER);
			dao=ClaimApproveOldPartStoredDao.getInstance();
			Map params=new HashMap<String, String>();
			params.put("id", request.getParamValue("id"));
			params.put("idStr", request.getParamValue("idStr"));
			String retCode=dao.validateIsSignOper(params);
			act.setOutData("finishFlag",retCode);
			act.setOutData("id", request.getParamValue("id"));
		} catch (Exception e) {
			BizException e1 = new BizException(act, e,ErrorCodeConstant.QUERY_FAILURE_CODE, "索赔旧件审批入库--在签收完成操作前检查工单是否完成签收操作");
			logger.error(logonUserBean, e1);
			act.setException(e1);
		}
	}
}
